<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JS Reference VS Copy</title>
</head>
<body>

  <script>
    /* Reference and copy
      Copy: strings, numbers, booleans
      Reference: object, json, array
    */


    /* Array : 
      1. let arr2 = [].concat(arr)
      2. let arr2 = arr.slice()
      3. let arr2 = [...arr]
      4. let arr2 - Array.from(arr)
    */


    /* Json, Object
      1. let obj2 = Object.assign({}, arr, {what you want to add or change})
      !Object.assign can not do deep copy
      !Use 
      2. let obj2 = JSON.parse(JSON.stringify(arr))
    */
    
  </script>

</body>
</html>
